package
{
	import Factory.Sample_Opertion1.Operation;
	import Factory.Sample_Opertion1.OperationFactory;
	import Factory.Sample_Opertion1.method.OperationAdd;
	import Factory.Sample_Opertion2.Operation;
	import Factory.Sample_Opertion2.OperationFactory;
	import Factory.Sample_Opertion2.method.OperationAdd;
	
	import flash.display.Sprite;
	
	public class DesignPatternsWarehouse extends Sprite
	{
		public function DesignPatternsWarehouse()
		{
			switch(2)
			{
				case 1:
					Factory_S1();
					break;
				case 2:
					Factory_S2();
					break;
			}
		}
		
		private function Factory_S1():void
		{
			var oper:Factory.Sample_Opertion1.Operation = Factory.Sample_Opertion1.OperationFactory.createOperate("+");
			oper.NumberA = 1;
			oper.NumberB = 2;
			var result:Number = oper.getResult();
			//随意修改Operation类的公共变量result
			oper.result = 4;
			result = oper.result;
			trace(result);
		}
		
		private function Factory_S2():void
		{
			var oper:Factory.Sample_Opertion2.Operation = Factory.Sample_Opertion2.OperationFactory.createOperate("+");
			oper.NumberA = 2;
			oper.NumberB = 3;
			var result:Number = oper.getResult();
			trace(result);
		}
	}
}